//index.js
//获取应用实例
var WxSearch = require('../../wxSearchView/wxSearchView.js');
var netWork = require('../../assets/js/network.js')
const app = getApp()
Page({
  data: {
    proList: [],
    pageNumber:1,
    resName:'',
    typeid:''
  },
  img1: function (e) {
    wx.navigateTo({
      url: `../../pages/content/content?id=${e.currentTarget.dataset.id}`
    })
  },
  init:function(){
    var This =this;
    wx.request({
      url: `${netWork.api}wzshortfilm/list?pageSize=8&currentPage=${This.data.pageNumber}&sidx=''&order=asc&typePid=${This.data.typeid}&shortfilmName=${This.data.resName}&lablePid=''`,
      method:'GET',
      success: function (res) {
        if (!res.data.code && res.data.page.list.length)
          This.setData({
            proList: This.data.proList.concat(res.data.page.list)
          })
        else
          wx.showToast({
            title: '没有数据',
            duration: 3000,
            icon: 'none',
            mask: 'true'
          })
      }
    })
  },
  onLoad: function (option) {
    wx.setNavigationBarTitle({
      title: `${option.text} 结果`,
    })
    console.log('内容', option.typeid)
    this.setData({
      resName: option.text ? option.text :'',
      typeid: option.typeid ? option.typeid :''
    })
    this.init()
  },
  onReachBottom: function () {
    this.init();
  }
})
